<template>
  <view>

    <view class="margin-sm padding bg-white">
      <view class="flex align-center">
        <view class="point"></view>
        <view>文章分类阅读时长</view>
      </view>
    </view>

    <view class="bg-white margin-tb">
      <view class="charts-box">
        <qiun-data-charts
            type="column"
            :chartData="categoryReadTimeChartData"
            background="none"
            :ontouch="true"
        />
      </view>
    </view>

    <view class="margin-sm padding bg-white">
      <view class="flex align-center">
        <view class="point"></view>
        <view>文章分类阅读次数</view>
      </view>
    </view>

    <view class="bg-white margin-tb">
      <view class="charts-box">
        <qiun-data-charts
            type="tarea"
            :chartData="categoryReadCountChartData"
            background="none"
        />
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: "historyChart",
  data() {
    return {
      categoryReadTimeChartData: {},
      categoryReadCountChartData: {},
      articleTopReadTimeChartData: {},
      articleTopReadCountChartData: {},


    }
  },
  mounted (){
      this.loadData();
  },
  methods:{
    loadData() {
      this.$api.getArticleHistoryChartData().then(res => {
        console.log(res)
        this.categoryReadTimeChartData = res.categoryReadTimeChartData
        this.categoryReadCountChartData = res.categoryReadCountChartData
        this.articleTopReadTimeChartData = res.articleTopReadTimeChartData
        this.articleTopReadCountChartData = res.articleTopReadCountChartData
        console.log(JSON.stringify(this.articleTopReadCountChartData))
      })
    }
  }
}
</script>

<style lang="scss">
.charts-box{
  width: 100%;
  /*height:300px;*/
}
.point {
  width: 20upx;
  height: 20upx;
  border-radius: 3upx;
  background: #4e6ef2;
  box-shadow: 5upx 10upx 16upx 0 rgba(78,111,242,.5);
  margin-right: 20upx;
}
</style>
